# Contributor: knuxify <knuxify@gmail.com>
# Maintainer: knuxify <knuxify@gmail.com>
pkgname=liblastfm-qt
pkgver=1.1.10_git20190823
pkgrel=2
_commit=2ce2bfe1879227af8ffafddb82b218faff813db9
pkgdesc="A Qt C++ library for the Last.fm webservices "
url="https://last.fm"
arch="all"
license="GPL-3.0-or-later"
makedepends="cmake qt5-qtbase-dev fftw-dev libsamplerate-dev"
subpackages="$pkgname-dev"
source="liblastfm-qt-$pkgver.tar.gz::https://github.com/lastfm/liblastfm/archive/$_commit.tar.gz
	remove-deprecated-staging-server.patch
	remove-dynamic-exception-specifications.patch"
builddir="$srcdir/liblastfm-$_commit"
options="!check" # broken, redirects don't work

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_FINGERPRINT=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
f225e8ce2a7838182ee1300941182fb97694966469f58b640815fc08c8664c35566bd7d82297c44ca33147caf4074c9d59125c571615ad37ce408d1e6e1e4295  liblastfm-qt-1.1.10_git20190823.tar.gz
844dd940058224bdc4610a4aad5a934ee398908fc5fea920df9437c71f4a23b40c445d5a052f162780458938b9c0917584dfe19cb904fb936c01a3f4f37d668d  remove-deprecated-staging-server.patch
a466b6a17e2977ed275ee094e0523f1b96590d089bf2fbf1ce345ea93ac57e0c3cb29b91bc0e47db794b8e02e2a098cc90c6a432ee1461d7d7ef28704303892d  remove-dynamic-exception-specifications.patch
"
